<?php

/* @var $this yii\web\View */

use yii\helpers\Url;
use \yii\helpers\Html;

$this->title = 'A-PMS资产管理系统';
$this->registerCssFile('/css/bootstrap.min.css');
$this->registerCssFile('/css/base.css');
$this->registerCssFile('/css/header-footer.css');
$this->registerCssFile('/css/index.css');
$this->registerCssFile('/css/paging.css');
$this->registerCssFile('/css/OfficeHall.css');
?>

<!-- Bootstrap -->
<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<!--	<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">-->
<!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
<!--<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">-->
<!--当遇到IE9以下的版本的使用会执行下面注释的代码  (HThtml5shiv.min.js和respond.js IE8支持HTML5元素和媒体查	询,respond.min.js在只能在服务器上运行,在本地不会运行-->
<!--[if lt IE 9]>
<script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->

<style type="text/css">
    em {
        color: #0000aa;
    }

    .entryimg p {
        font-size: 14px;
        color: #666;
        margin-top: 18px;
        text-align: center;
    }

    .navbar {
        border: none;
    }

    .searchs {
        position: relative;
    }

    .data-ul {
        width: 765px;
        border: 1px solid rgb(33, 148, 221);
        border-top: none;
        position: absolute;
        top: 40px;
        left: 0;
        z-index: 999;
        background: #fff;
    }

    .data-ul li {
        font-size: 14px;
        color: #333;
        padding-left: 12px;
        line-height: 20px;
    }

    .data-ul li:hover {
        background: #e2e2e2;
    }

    /*c查询检索悬浮状态*/
    .OfficeHallContent .search .options span:hover {
        color: #2194f1;
    }
</style>
<div class="OfficeHallContent container1200 clearfix">
    <!-- 查询检索开始!!!!!!!!!!!! -->
    <div class="search pull-left">
        <div class="perfect-logo ">
            <?php echo Html::img('@web/image/officeHall/uploadAssetPackage/wsxx.png', ['class' => 'pull-left']); ?>
            <span class="pull-left">查询检索</span>
        </div>
        <div class="searchs clearfix" id="search-all">
            <input type="text" name="" id="keyWord" class="pull-left" placeholder="请输入您要查找的关键词">
            <?php if (webvimark\modules\UserManagement\models\User::hasRole('partner') == false) echo Html::img('@web/image/officeHall/searchs.png', ['class' => 'pull-left', 'id' => 'searchGo']); ?>
            <ul class='data-ul' style='display: none;'>
            </ul>
        </div>
        <div class="options">
            <span class="active" id="allSearch">全部</span>
            <span class="" id="packageSearch">资产包</span>
            <span class="" id="projectSearch">项目</span>
        </div>
    </div>
    <!-- 查询检索结束!!!!!!!!!!!! -->

    <!-- 个人信息开始!!!!!!!!!!!! -->
    <div class="person pull-right clearfix">
        <?php
        if (!empty($userData['avatar'])) {
            $avatar = $userData['avatar'];
            echo Html::img($avatar, ['class' => 'person-img']);
        } else {
            echo Html::img('/image/officeHall/person.png', ['class' => 'person-img']);
        }
        ?>

        <div class="person-name ">
            <p><?= !empty($userData['username']) ? $userData['username'] : '' ?></p>
            <p><?= !empty($userData['department']) ? $userData['department_desc'] : '无部门' ?>
                /<?= !empty($userData['post']) ? $userData['post_desc'] : '无岗位' ?></p>
        </div>

        <div class="pakage  clearfix">
            <a class="pull-left person1" href="<?php echo Url::toRoute(['my-package/get-my-package']); ?>">
                <?php echo Html::img('@web/image/officeHall/person12.png'); ?>
                <p>我的资产包</p>
            </a>
            <a class="pull-left person2" href="<?= Url::toRoute('my-project/my-involvement'); ?>">
                <?php echo Html::img('@web/image/officeHall/person22.png'); ?>
                <p>我的项目</p>
            </a>
            <a class="pull-left person3" href="<?= Url::toRoute('instation-message/index'); ?>">
                <?php echo Html::img('@web/image/officeHall/person32.png'); ?>
                <p>我的提醒</p>
                <span class="remind"></span>
            </a>
        </div>
    </div>
    <!-- 个人信息结束!!!!!!!!!!!! -->

    <!-- 快捷入口开始!!!!!!!!!!!! -->
    <div class="entry pull-left">
        <div class="perfect-logo">
            <?php echo Html::img('@web/image/officeHall/uploadAssetPackage/wsxx.png', ['class' => 'pull-left']) ?>
            <span class="pull-left">快捷入口</span>
        </div>
        <div class="entryimg clearfix">
            <a href="<?= Url::toRoute('package/index'); ?>" class="pull-left entry1">
                <?php echo Html::img('@web/image/officeHall/entry12.png'); ?>
                <p>上传资产包</p>
            </a>
            <a href="<?= Url::toRoute('search-package/search'); ?>" class="pull-left entry2">
                <?php echo Html::img('@web/image/officeHall/entry22.png'); ?>
                <p>资产包管理</p>
            </a>
            <a href="<?= Url::toRoute('project/'); ?>" class="pull-left entry3">
                <?php echo Html::img('@web/image/officeHall/entry32.png'); ?>
                <p>项目管理</p>
            </a>
            <a href="<?= Url::toRoute('audit-management/access'); ?>" class="pull-left entry4">
                <?php echo Html::img('@web/image/officeHall/entry42.png'); ?>
                <p>审批管理</p>
            </a>
            <a href="<?= Url::to(['/yue-juan/index']) ?>" class="pull-left entry5">
                <img src="/image/officeHall/entry52.png">
                <p>智能阅卷</p>
            </a>
        </div>
    </div>
    <!-- 快捷入口结束!!!!!!!!!!!! -->
</div>


<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/common.js"></script>
<!-- <script type="text/javascript" src="/js/bootstrap.min.js"></script>-->
<script type="text/javascript" src="/js/index.js"></script>
<script type="text/javascript" src="/js/paging.js"></script>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<!--<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>-->
<!-- Include all compiled plugins (below), or include individual files as needed -->
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<!--<scriptsrc="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>-->
<script type="text/javascript">
    ajaxGetMessageNum();
    function ajaxGetMessageNum() {
        $url = '/instation-message/index';
        $data = [];
        $(".remind").hide();
        $.get($url, $data, function (res) {
            if (res > 0) {
                $(".remind").show();
                $(".remind").text(res)
            } else {
                $(".remind").hide()
            }
        })
    }
    $(function () {
        //--------------点击搜索-----fly--------------------------
        keyWord = ''; // 关键词
        type = 1; // 默认所有
        //--点击所有按钮-----
        $("#allSearch").click(function () {
            $("#search-all ul li").remove();
            type = 1;
        })
        //-点击资产包按钮-----
        $("#packageSearch").click(function () {
            $("#search-all ul li").remove();
            type = 2;
        })
        //-点击项目按钮-----
        $("#projectSearch").click(function () {
            $("#search-all ul li").remove();
            type = 3;
        })
        $("#searchGo").click(function () {
            keyWord = $("#keyWord").val();
            switch (type) {
                case 1:
                    var url = "/search-all/index/?keyWords=" + keyWord + "&entry=sala&postion=1";
                    window.location.href = url;
                    break;
                case 2:
                    var url = "/search-all/index/?keyWords=" + keyWord + "&entry=sala&postion=2";
                    window.location.href = url;
                    break;
                default:
                    var url = "/search-all/index/?keyWords=" + keyWord + "&entry=sala&postion=3";
                    window.location.href = url;
                    break;
            }
        })
        //--------------点击搜索-----fly--------------------------
        $(".options span").click(function () {
            $(this).addClass("active").siblings().removeClass("active");
            if ($(this).attr("id") == "packageSearch") {
                $("#keyWord").attr("placeholder", "请输入您要查找的资产包关键词");
            } else if ($(this).attr("id") == "projectSearch") {
                $("#keyWord").attr("placeholder", "请输入您要查找的项目关键词");
            } else {
                $("#keyWord").attr("placeholder", "请输入您要查找的关键词");
            }
        });
        $(document).keyup(function (event) {
            if (event.keyCode == 13) {
                $("#searchGo").trigger("click");
            }
        });
        //---------------------联想数据-----------fly
        $("#keyWord").on("keyup", function (e) {
            $this = $(this);
            last = e.timeStamp;
            setTimeout(function () {
                // console.log(e.timeStamp);
                var $data_data = $this.val();
                if (last - e.timeStamp === 0) {
                    $.ajax({
                        type: "get",
                        url: "/search-all/ajax-key-word",
                        data: {
                            keyWords: $data_data,
                            group: type
                        },
                        success: function (data) {
                            var josnData = JSON.parse(data);
                            if (josnData.code == 200 && josnData.data.count > 0) {
                                titleKeywords(josnData.data.res)
                                $(".data-ul").show();
                            } else {
                                $("#search-all  ul li").remove();
                                $(".data-ul").hide();
                            }
                        },
                        onerror: function () {
                            console.log("not ok");
                        }
                    })
                }
            }, 100)
        })
        function titleKeywords(data) {
            $("#search-all ul li").remove();
            $("#search-all ul").append(data);
            $("#search-all ul").show();
        }

        //---------------------联想数据-----------fly
    });
</script>
